import re
import requests

def get_cookie():
    session = requests.Session()
    headers = {
            'User-Agent': 'yuanrenxue.project'
    }
    resp = session.get('http://match.yuanrenxue.com/match/13')
    pattern = r"'(?P<cookie>.?)'"
    cookie = re.findall(pattern,resp.text)
    cookie = ''.join(cookie)
    key,value = cookie.split('=')
    session.cookies.set(key,value)

    sum = 0
    for i in range(1,6):
        api_url = f"http://match.yuanrenxue.com/api/match/13?page={i}"
        r = session.get(api_url, headers=headers)
        data = r.json()
        values = data["data"]
        for value in values:
            sum += value["value"]
    print(sum)

get_cookie()